package com.senjoeson.publicsource.kotlin

import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter

/**
 *
 *@author sunqiao
 *@date 2018/5/28 17:19
 */
class SimpleFragmentPagerAdapter(fm: FragmentManager) :FragmentPagerAdapter(fm){

    private var tilte: Array<String>? = null
    private var mFragments: List<Fragment>? = null


    fun setTilte(tilte: Array<String>) {
        this.tilte = tilte
    }

    fun setFragments(fragments: List<Fragment>) {
        mFragments = fragments
    }

    override fun getItem(position: Int): Fragment {
        return mFragments!![position]
    }

    override fun getCount(): Int {
        return tilte!!.size
    }

    override fun getPageTitle(position: Int): CharSequence {
        return tilte!![position]
    }


}